package com.wanxi.education.filter;

import com.wanxi.education.common.CommonResult;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * @Author: Kang
 * @Description: 全局异常处理
 * @Date: 2021/9/24 11:03
 * @Version: 1.0
 */
@ControllerAdvice
public class GlobalExceptionHandler {
    @ResponseBody
    @ExceptionHandler(RuntimeException.class)
    public CommonResult handleCustomException(Exception e) {
        System.out.println(e);
        return CommonResult.failure("程序休息会，等会重试");
    }
}
